import React from 'react'
import Six from './Six'
import Ten from './Ten'

class Niuniu extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
    }
  }

  componentDidMount() {
  }

  componentDidUpdate() {
  }

  render() {
    const {battleData, gameInfo, backroom} = this.props
    const {room} = battleData
    const roomDescribe = JSON.parse(room.roomDescribe)
    const ruleName = (roomDescribe.ruleType === 0 || roomDescribe.bankerType === 0) ? `${roomDescribe.turns}轮庄` : `${roomDescribe.turns * 15}局`
    const ruleDesc = `明${roomDescribe.showCardCount},${ruleName}`
    const shareStyle = {width: gameInfo.width, height: gameInfo.height, margin: 'auto'}
    return <div id="share" className="result-wrapper" style={shareStyle}>
      {
        roomDescribe.maxPlayerCount === 6 ? <Six backroom={backroom} battleData={battleData} gameInfo={gameInfo} ruleDesc={ruleDesc}></Six>
          : <Ten backroom={backroom} battleData={battleData} gameInfo={gameInfo} ruleDesc={ruleDesc}></Ten>
      }
    </div>
  }
}

export default Niuniu